#ifndef PLAY_MANAGER_H
#define PLAY_MANAGER_H

class PlayManager;

#include <vector>

#include "GameState.h"
#include "GameSession.h"
#include "SingleUserPlayState.h"
#include "MenuInGame.h"
#include "GameResources.h"

// Enumerate all states of play
typedef enum {
    psSELECTED,
    psLOADING,
    psPLAYING,
    psSUCCESSFUL,
    psCOMPLETE,
    psFAILED,
    psFINISHED,
    psPLAYING_REPLAY,
    psREPLAY_LEVEL,
    psPLAY_REPLAY,
    psNEXT_LEVEL,
    psQUIT,
    psCREDITS
} StateOfPlay;

/*
 * General play manager class
 */
class PlayManager : public GameState
{
    public:
	    PlayManager(void) {}
       ~PlayManager(void) {}
       
	    void enter(void) {};
	    void exit(void) {}
	    bool pause(void) { return true; }
        void resume(void) {};
        
        void getStatePointers();
        void getResourcesPointer(GameResources *r) { resources = r; }
        void clearSessions();
        void updateStateFromSession(GameSession *);
        void updateStateFromMenu();
        
        bool keyPressed(const OIS::KeyEvent &) { return true; }
        bool keyReleased(const OIS::KeyEvent &) { return true; }
        bool mouseMoved(const OIS::MouseEvent &) { return true; }
        bool mousePressed(const OIS::MouseEvent &, OIS::MouseButtonID) { return true; }
        bool mouseReleased(const OIS::MouseEvent &, OIS::MouseButtonID) { return true; }

    protected:
        // Keep a pointer to menu to set layout
        MenuInGame *menu;
        // To assign to multiple players
        std::vector<GameSession *> sessions;
        // Keep track of the current state
        StateOfPlay currentState;
        // Keep a pointer to SingleUserPlayState to set session pointers
        SingleUserPlayState *suPlayState;
        // Game resources pointer
        GameResources *resources;
};

#endif
